<?php
require "common.php";
$common=new Common();
if (!empty($_SESSION['id'])){
    $sql="select * from lunwen_user_info where id='".$_SESSION['id']."';";
    $query=mysqli_query($common->startMysql(),$sql);
    $info_arr=mysqli_fetch_array($query,MYSQLI_ASSOC);
    $jump_key_arr=['password','id','stuid'];
    $_SESSION['form_token']=md5(mt_rand(0,999999999));
    $msg['form_token']=$_SESSION['form_token'];
    $msg["basic_info"]=[];
    $msg["basic_info"]['stuid']=$_SESSION['stuid'];

    foreach (array_keys($info_arr) as $key_v){
        if (in_array($key_v,$jump_key_arr)) continue;
        $msg["basic_info"][$key_v]=null;


        if (!empty($info_arr[$key_v])){
            $sql="SELECT * FROM lunwen_yuanfile WHERE id='".$info_arr[$key_v]."';";
            $query=mysqli_query($common->startMysql(),$sql);
            $info_arr_yuanfile=mysqli_fetch_array($query,MYSQLI_ASSOC);
            if ($info_arr_yuanfile){
                $msg["basic_info"][$key_v]=$info_arr_yuanfile["正文内容"];
            }
        }
    }

    Common::rs($msg);
}